package
{
	
	import org.flixel.*;

	public class ModalAreYouSurePopup extends FlxGroup
	{
		
		protected var yesButton:FlxSprite;
		protected var noButton:FlxSprite;
		protected var done:Boolean;
		protected var yes:Boolean;
		
		public function ModalAreYouSurePopup()
		{
			done = false;
			yes = false;
			var bg:FlxSprite = new FlxSprite(83,113,Res.areYouSureBG);
			
			this.add(bg);
			
			var titleText:FlxText = new FlxText(107, 137, 300, "Are You Sure?", false);
			titleText.setFormat("Arial", 36, 0x111111, "center");
			this.add(titleText);
			
			
			yesButton = new FlxSprite(158, 250, Res.yesButton);
			noButton = new FlxSprite(283, 250, Res.noButton);
			this.add(yesButton);
			this.add(noButton);
		}
		
		public override function update():void  {
			super.update();
			
			if (FlxG.mouse.justPressed()) {
				if (yesButton.overlapsPoint(FlxG.mouse.x, FlxG.mouse.y)) {
					done = true;
					yes = true;
				} else if (noButton.overlapsPoint(FlxG.mouse.x, FlxG.mouse.y)) {
					done = true;
				}
			}
		}
		
		
		public function finishedPopup():Boolean {
			return done;
		}
		
		public function wasYes():Boolean {
			return yes;
		}
	}
}